import { ref, onMounted, onUnmounted } from 'vue'
import { getweather } from '@/views/request/index.ts'
export const useMouse = () => {

    const x = ref(0)
    const y = ref(0)

    function update(event) {
        x.value = event.pageX * 2
        y.value = event.pageY * 2
    }

    onMounted(() => window.addEventListener('mousemove', update))
    onUnmounted(() => window.removeEventListener('mousemove', update))

    return { x, y }
}

//如果是接口
export const useTable = (gettale, initparams) => {
    const tableist = ref()
    getweather(initparams).then(res => {
        console.log(res);
        tableist.value = res.data.air
    })
    return { tableist }
}